public class SimpleInsertSort {
    /**
     *
     * @param array
     */
    public  static void sort(int[] array){
        int length = array.length;
        int temp;
        for(int i=1;i<length;i++){
            temp = array[i];
            int j =i-1;
            while(j>=0 && array[j]>temp){
                array[j+1]=array[j];
                j--;
            }
            array[j+1]=temp;
    }

    }

    public static void main(String[] args) {
        int[] array={3,9,6,4,2,1,7,0,5,8};
        sort(array);
        for(int i=0;i<array.length;i++){
            System.out.println(array[i]);

        }
    }
}